Skip to content

feat: add trace_metric_byte to DataCategory enum#5626

Merged
romtsn merged 6 commits into
getsentry:mainfrom
tsushanth:fix-trace-metric-byte-data-category
Jul 3, 2026
Merged

feat: add trace_metric_byte to DataCategory enum#5626
romtsn merged 6 commits into
getsentry:mainfrom
tsushanth:fix-trace-metric-byte-data-category

Conversation

@tsushanth

Copy link
Copy Markdown
Contributor

Fixes #5618

The DataCategory enum was missing a trace_metric_byte entry, which is defined in the Sentry SDK developer docs as a byte-count category for trace metrics. Without it, client outcome reporting cannot correctly attribute discarded trace metric bytes, so those losses go untracked.

This change adds TraceMetricByte("trace_metric_byte") to DataCategory, following the same pattern as TraceMetric, LogItem, LogByte, and other categories. The existing DataCategory.valueOf(StringUtils.camelCase(catItem)) path in RateLimiter will automatically resolve "trace_metric_byte" to the new enum value when it appears in rate-limit response headers.

@runningcode runningcode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tsushanth

Copy link
Copy Markdown
Contributor Author

Done — added TraceMetricByte to the API dump file manually (alphabetically after TraceMetric in the DataCategory block).

tsushanth and others added 4 commits July 3, 2026 11:08
… discarded

Mirrors the LogByte pattern: records byte-level data category alongside the
item-level one when trace metrics are dropped by beforeSendMetrics, queue
overflow, or envelope discard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@romtsn romtsn force-pushed the fix-trace-metric-byte-data-category branch from 2eac35d to 5dc77d0 Compare July 3, 2026 09:16
romtsn and others added 2 commits July 3, 2026 11:31
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@adinauer adinauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Changes look good to me but while reviewing I noticed some gaps in both this and the pre-existing log_byte handling:

  • EventProcessor discards aren't tracked
  • Rate limiter doesn't apply the *_byte categories to the respective feature

I'll open PRs to address these.

@romtsn romtsn merged commit 2ad4e0d into getsentry:main Jul 3, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire trace_metric_byte client outcome reporting

4 participants